<template>
  <PostList
      :data="data"
      :total="total"
      @get-data="getData"
  >
  </PostList>
</template>
<script setup>
import {useLoginUserStore} from "@/store/userStore";
import PostList from "@/components/PostList.vue";
import {ref} from "vue";
import {listFavourPostVOByPageUsingPost} from "@/api/PostRequest";

const userLoginStore = useLoginUserStore();

const data = ref([]);
const total = ref(0);

async function getData(current , pageSize){
  const result = await listFavourPostVOByPageUsingPost({
    current: current,
    pageSize: pageSize,
    sortField: 'createTime',
    sortOrder: 'descend',
    userId: userLoginStore.loginUser.id
  });
  data.value = result.data.data.records;
  total.value = result.data.data.total;
}
</script>

<style scoped>

</style>